package com.css.fxfzypg.modules.statistics.controller;

import com.alibaba.fastjson.JSONObject;
import com.css.fxfzypg.base.response.RestResponse;
import com.css.fxfzypg.modules.statistics.service.StatisticsService;
import com.css.fxfzypg.modules.statistics.vo.QueryParams;
import com.css.fxfzypg.modules.statistics.vo.ResultVo;
import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/statistics")
public class StatisticsController {

    @Autowired
    StatisticsService statisticsService;

    @PostMapping("/getNumberByType")
    public RestResponse getNumberByType(@RequestBody QueryParams queryParams) {
        RestResponse response = null;
        try {
            ResultVo airport = statisticsService.getNumberByType(queryParams);
            response = RestResponse.succeed(airport);
            response.setMessage("查询成功");
        } catch (Exception e) {
            String errorMessage = "查询失败!";
            log.error(errorMessage, e);
            response = RestResponse.fail(errorMessage);
        }
        return response;
    }



}
